<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
    xmlns:s="http://jboss.com/products/seam/taglib"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:rich="http://richfaces.org/rich"
    template="layout/template.xhtml">

<ui:define name="body">

    <rich:panel>
        <f:facet name="header">Channels Details</f:facet>

        <s:decorate id="epgPos" template="layout/display.xhtml">
            <ui:define name="label">Epg pos</ui:define>
            <h:outputText value="#{channelsHome.instance.epgPos}"/>
        </s:decorate>

        <s:decorate id="name" template="layout/display.xhtml">
            <ui:define name="label">Name</ui:define>
            <h:outputText value="#{channelsHome.instance.name}"/>
        </s:decorate>

        <s:decorate id="image" template="layout/display.xhtml">
            <ui:define name="label">Image</ui:define>
            <h:outputText value="#{channelsHome.instance.image}"/>
        </s:decorate>

        <s:decorate id="favourite" template="layout/display.xhtml">
            <ui:define name="label">Favourite</ui:define>
            <h:outputText value="#{channelsHome.instance.favourite}"/>
        </s:decorate>

        <s:decorate id="channelSigla" template="layout/display.xhtml">
            <ui:define name="label">Channel sigla</ui:define>
            <h:outputText value="#{channelsHome.instance.channelSigla}"/>
        </s:decorate>

        <div style="clear:both"/>

    </rich:panel>

    <div class="actionButtons">

        <s:button view="/ChannelsEdit.xhtml"
                    id="edit"
                 value="Edit"/>

        <s:button view="/#{empty channelsFrom ? 'ChannelsList' : channelsFrom}.xhtml"
                    id="done"
                 value="Done"/>

    </div>

    <rich:tabPanel switchType="ajax">

    <rich:tab>
        <f:facet name="label">
            <h:panelGroup><h:graphicImage value="/img/onetomany.gif" style="vertical-align: middle; padding-right: 4px;"/>Tv programs</h:panelGroup>
        </f:facet>
    <h:form styleClass="association" id="tvProgramsChildren">

        <h:outputText value="There are no tvPrograms associated with this channels."
                   rendered="#{empty channelsHome.tvPrograms}"/>

        <rich:dataTable value="#{channelsHome.tvPrograms}"
                       var="_tvProgram"
                  rendered="#{not empty channelsHome.tvPrograms}"
                rowClasses="rvgRowOne,rvgRowTwo"
                        id="tvProgramsTable">
            <rich:column sortBy="#{_tvProgram.programId}">
                <f:facet name="header">Program id</f:facet>
                <h:outputText value="#{_tvProgram.programId}"/>
            </rich:column>
            <rich:column sortBy="#{_tvProgram.dateTime}">
                <f:facet name="header">Date time</f:facet>
                <h:outputText value="#{_tvProgram.dateTime}">
                    <s:convertDateTime type="both" dateStyle="short"/>
                </h:outputText>
            </rich:column>
            <rich:column sortBy="#{_tvProgram.name}">
                <f:facet name="header">Name</f:facet>
                <h:outputText value="#{_tvProgram.name}"/>
            </rich:column>
            <rich:column sortBy="#{_tvProgram.shortDescription}">
                <f:facet name="header">Short description</f:facet>
                <h:outputText value="#{_tvProgram.shortDescription}"/>
            </rich:column>
            <rich:column sortBy="#{_tvProgram.longDescription}">
                <f:facet name="header">Long description</f:facet>
                <h:outputText value="#{_tvProgram.longDescription}"/>
            </rich:column>
            <rich:column sortBy="#{_tvProgram.id}">
                <f:facet name="header">Id</f:facet>
                <h:outputText value="#{_tvProgram.id}"/>
            </rich:column>
            <rich:column sortBy="#{_tvProgram.endDateTime}">
                <f:facet name="header">End date time</f:facet>
                <h:outputText value="#{_tvProgram.endDateTime}">
                    <s:convertDateTime type="both" dateStyle="short"/>
                </h:outputText>
            </rich:column>
            <h:column>
                <f:facet name="header">Action</f:facet>
                <s:link id="selecttvProgram"
                     value="Select"
                      view="/TvProgram.xhtml">
                    <f:param name="tvProgramProgramId"
                            value="#{_tvProgram.programId}"/>
                    <f:param name="tvProgramFrom" value="Channels"/>
                </s:link>
            </h:column>
        </rich:dataTable>

    </h:form>

    <div class="actionButtons">
        <s:button
               value="Add tvProgram"
                view="/TvProgramEdit.xhtml">
            <f:param name="channelsEpgPos"
                    value="#{channelsHome.instance.epgPos}"/>
            <f:param name="tvProgramFrom" value="Channels"/>
        </s:button>
    </div>
    </rich:tab>

    <rich:tab>
        <f:facet name="label">
            <h:panelGroup><h:graphicImage value="/img/onetomany.gif" style="vertical-align: middle; padding-right: 4px;"/>Channels categories</h:panelGroup>
        </f:facet>
    <h:form styleClass="association" id="channelsCategoriesChildren">

        <h:outputText value="There are no channelsCategories associated with this channels."
                   rendered="#{empty channelsHome.channelsCategories}"/>

        <rich:dataTable value="#{channelsHome.channelsCategories}"
                       var="_channelsCategory"
                  rendered="#{not empty channelsHome.channelsCategories}"
                rowClasses="rvgRowOne,rvgRowTwo"
                        id="channelsCategoriesTable">
            <rich:column sortBy="#{_channelsCategory.id.id}">
                <f:facet name="header">Id</f:facet>
                <h:outputText value="#{_channelsCategory.id.id}"/>
            </rich:column>
            <rich:column sortBy="#{_channelsCategory.id.epgpos}">
                <f:facet name="header">Epgpos</f:facet>
                <h:outputText value="#{_channelsCategory.id.epgpos}"/>
            </rich:column>
            <h:column>
                <f:facet name="header">Action</f:facet>
                <s:link id="selectchannelsCategory"
                     value="Select"
                      view="/ChannelsCategory.xhtml">
                    <f:param name="channelsCategoryId"
                            value="#{_channelsCategory.id.id}"/>
                    <f:param name="channelsCategoryEpgpos"
                            value="#{_channelsCategory.id.epgpos}"/>
                    <f:param name="channelsCategoryFrom" value="Channels"/>
                </s:link>
            </h:column>
        </rich:dataTable>

    </h:form>

    <div class="actionButtons">
        <s:button
               value="Add channelsCategory"
                view="/ChannelsCategoryEdit.xhtml">
            <f:param name="channelsEpgPos"
                    value="#{channelsHome.instance.epgPos}"/>
            <f:param name="channelsCategoryFrom" value="Channels"/>
        </s:button>
    </div>
    </rich:tab>
</rich:tabPanel>
</ui:define>

</ui:composition>
